import { useEffect, useState } from "react"
import { nav } from '../../apis/home'
import style from "../../style/home/nav.module.scss"
interface Nav{
    title:String,
    imgurl:string,
    navid:number
}
export default function Nav() {
    let [list, setlist] = useState<Array<Nav>>([])
    useEffect(() => {
        nav().then((ok) => {
            setlist(ok.data)
        })
    }, [])
    return (
        <div className={style.list}>
            {
                list.map((item,index)=>{
                    return(
                        <div className={style.item }key={index}>
                            <img src={item.imgurl} alt="" />
                            <span>{item.title}</span>
                        </div>
                    )
                })
            }
        </div>
    )
}
